﻿using System;
using Newtonsoft.Json;

namespace T.FAS.Runtime.Metadata.Entity.DataModel
{
    /// <summary>
    /// 数据查询-数据源
    /// </summary>
    [Serializable]
    public class DataQuerySubQuery : ICloneable
    {
        /// <summary>
        /// 主键id
        /// </summary>
        public string ID { get; set; }
        
        /// <summary>
        /// 数据查询ID
        /// </summary>
        public string DataQueryID { get; set; }

        /// <summary>
        /// 子查询DQ的ID
        /// </summary>
        public string SubQueryID { get; set; }

        /// <summary>
        /// 子查询
        /// </summary>
        public DataQuery SubQuery { get; set; }

        /// <summary>
        /// 子查询别名
        /// </summary>
        public string SubQueryAlias { get; set; }

        /// <summary>
        /// 主查询关联列ID
        /// </summary>
        public string MainQueryColumnID { get; set; }

        /// <summary>
        /// 子查询关联列ID
        /// </summary>
        public string SubQueryColumnID { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 备用字段
        /// </summary>
        [JsonIgnore]
        public string Ext1 { get; set; }

        /// <summary>
        /// 备用字段
        /// </summary>
        [JsonIgnore]
        public string Ext2 { get; set; }

        /// <summary>
        /// 备用字段
        /// </summary>
        [JsonIgnore]
        public string Ext3 { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [JsonIgnore]
        public string Creator { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>        
        [JsonIgnore]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 最后修改人
        /// </summary>
        [JsonIgnore]
        public string LastModifier { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>        
        [JsonIgnore]
        public DateTime LastModifyTime { get; set; }

        public object Clone()
        {
            var source = this.MemberwiseClone() as DataQuerySource;

            return source;
        }
    }
}

